/* This is very low-quality code.
It is intended to illustrate bad programming practices.
See Practice Problem 3.46. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/* implementation of library function gets() */
char *my_gets(char *s) {
  int c;
  char *dest = s;
  while ((c = getchar()) != '\n' && c != EOF)
    *dest++ = c;
  if (c == EOF && dest == s)
    /* No characters read */
    return NULL;
  *dest++ = '\0'; /* Terminate string */
  return s;
}

char *get_line() {
  char buf[4];
  char *result;
  my_gets(buf);
  result = malloc(strlen(buf));
  strcpy(result, buf);
  return result;
}

int main() {
  get_line();

  return 0;
}